import React from 'react'
import {Modal} from "antd";
import FormComponent from "../form/FormComponent";
export default class Dialog extends React.Component {

    state = {
        modalVisible: false
    }

    constructor(props) {
        super(props);
        this.setState({
            modalVisible: props.show
        },()=>{
            console.log(this.state,'ddd')
        })

    }

    modalOkHandler = (e)=>{
        console.log(e.target);
        this.setState({modalVisible: false});
    }

    modalCancelHandler = ()=>{
        this.setState({modalVisible: false})
    }

    render() {
        return (
            <>
                <Modal
                    title={'新增任务窗口'}
                    onOk={this.modalOkHandler}
                    open={this.state.modalVisible}
                    onCancel={this.modalCancelHandler} footer={null}>
                    <FormComponent/>
                </Modal>
            </>
        )
    }

    shouldComponentUpdate(nextProps, nextState){
        return true;
    }

}